function load_javascript(filename){
	var fileref = document.createElement('script');
	fileref.setAttribute("type", "text/javascript");
	fileref.setAttribute("src", filename);
	document.getElementsByTagName("head")[0].appendChild(fileref);
}

var scripts = new Array("lib/main.js","lib/modules/problem.js","lib/modules/scoreboard.js","lib/modules/user.js");

var load_script_count = 0;

function load_next_script(){
	if (load_script_count < scripts.length) {
		$.getScript(CAKE_ROOT +"app/webroot/js/" +scripts[load_script_count++], load_next_script);
	} else {
		LS.init();
	}
}

$(document).ready(load_next_script);